package view;

import java.awt.Image;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Map;

import model.map.Direction;


public class DirectionalModelToImage {
	/**
	 * This Map is a map between modelName to a imageName with its directional flag
	 * 
	 */
	private static final Map<String, Map<Direction, String>> imageNames = new HashMap<String, Map<Direction, String>>();
	private static BufferedImage dummy = new BufferedImage( 10,10,BufferedImage.TYPE_INT_ARGB );
	/**
	 * Returns the Image with the associated direction
	 * @param modelName the name of the image that is associated to the model
	 * @param d the direction one wants
	 * @return Image of the model
	 */
	public static Image getImage(String modelName, Direction d) {
		Map<Direction, String> m = imageNames.get(modelName);
		return m == null ? dummy : ImageFileToImage.getImage(imageNames.get(modelName).get(d));
	}
	/**
	 * Allows one to add images to the static imageTable
	 * @param modelName The key to add
	 * @param directionalImages the map of directional images
	 */
	public static void addImage(String modelName, Map<Direction, String> directionalImages) {
		imageNames.put(modelName, directionalImages);
	}
	
}
